home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmini
- BorderStyle = 1 'Fixed Single
- Caption = "Sample INI program"
- ClientHeight = 2625
- ClientLeft = 3225
- ClientTop = 4530
- ClientWidth = 4890
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2625
- ScaleWidth = 4890
- StartUpPosition = 2 'CenterScreen
- Begin VB.TextBox Keyname
- Height = 285
- Left = 120
- TabIndex = 4
- Top = 720
- Width = 2295
- End
- Begin VB.TextBox appname
- Height = 285
- Left = 120
- TabIndex = 3
- Top = 360
- Width = 4695
- End
- Begin VB.TextBox txtvalue
- Height = 285
- Left = 2520
- TabIndex = 2
- Top = 720
- Width = 2295
- End
- Begin VB.CommandButton cmdget
- Caption = "Recall"
- Height = 375
- Left = 120
- TabIndex = 1
- Top = 2160
- Width = 4695
- End
- Begin VB.CommandButton cmdstore
- Caption = "Store"
- Height = 375
- Left = 120
- TabIndex = 0
- Top = 1680
- Width = 4695
- End
- Begin VB.Label Label3
- Caption = "Value"
- Height = 255
- Left = 3480
- TabIndex = 7
- Top = 1080
- Width = 495
- End
- Begin VB.Label Label2
- Caption = "Setting"
- Height = 255
- Left = 960
- TabIndex = 6
- Top = 1080
- Width = 615
- End
- Begin VB.Label Label1
- Caption = "Heading"
- Height = 255
- Left = 1920
- TabIndex = 5
- Top = 0
- Width = 735
- End
- Attribute VB_Name = "frmini"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim IniFileName As String
- Private Sub cmdget_Click()
- Dim X As Long
- Dim Temp As String * 50
- Dim lpAppName As String, lpKeyName As String, lpDefault As String, lpFileName As String
- lpAppName = appname.Text
- lpKeyName = Keyname.Text
- lpDefault = file
- lpFileName = file
- X = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
- If X = 0 Then
- Beep
- txtvalue.Text = Trim(Temp)
- End If
- End Sub
- Private Sub cmdstore_Click()
- Dim lpAppName As String, lpFileName As String, lpKeyName As String, lpString As String
- Dim U As Long
- lpAppName = appname.Text
- lpKeyName = Keyname.Text
- lpString = txtvalue.Text
- lpFileName = file
- U = WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName)
- If U = 0 Then
- End If
- End Sub
- Private Sub Form_Initialize()
- IniFileName = file
- End Sub
- Private Sub Form_Load()
- file = InputBox("Which file do you want to read/edit/create?")
- End Sub
-